import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/booking/bookingHistory/provider/booking_history_provider.dart';
import 'package:boss/ui/widget/split_line.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class BookingHistoryHeader extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 160.w,
      margin: EdgeInsets.only(
        left: 20.w,
        right: 20.w,
        bottom: 30.w,
      ),
      decoration: BoxDecoration(
        image: DecorationImage(
          fit: BoxFit.fill,
          image: AssetImage('assets/image/takeout_bg.png'),
        ),
      ),
      child: Consumer<BookingHistoryProvider>(
        builder: (context, provider, _) {
          return Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              buildMessage('预订单', provider.totalBookNum ?? 0),
              SplitLine(height: 80.w),
              buildMessage('就餐人数', provider.totalPersonNum ?? 0),
            ],
          );
        },
      ),
    );
  }

  Column buildMessage(String title, int value) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text(
          '$value',
          style: TextStyle(
            fontSize: 36.sp,
            color: Colors.white,
            fontWeight: FontWeight.bold,
            fontFamily: 'DINAlternate-Bold',
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 20.w),
          child: Text(
            title,
            style: TextStyleConstant().white_28,
          ),
        ),
      ],
    );
  }
}
